<?php
/**
 * Created by PhpStorm.
 * User: stupboy
 * Date: 2018/2/3
 * Time: 22:28
 */

namespace app\api\logic;


class Login
{
    /**
     * 生成司机登入token
     */
    public function createDriverToken($phone,$redis,$zone='jjcx.driver.'){
        $str  = $zone.md5($phone);
        $has  = $redis->keys($str.'*');
        foreach($has as $v){
            $redis->del($v);
        }
        $time = time();
        return $str.'@'.$time;
    }

    /**
     * 生成乘客登入token
     */
    public function createPassengerToken($phone,$redis,$zone='jjcx.passenger.'){
        $str  = $zone.md5($phone);
        $has  = $redis->keys($str.'*');
        foreach($has as $v){
            $redis->del($v);
        }
        $time = time();
        return $str.'@'.$time;
    }

}